<?php $this->load->view('inc/header2');?>
<?php html_js('scrollpage/scrollpagination.js');?>

<div style="width: 600px;margin: 0px auto;margin-top: 30px;">

    <div style="text-align: center;">
    	<a href="<?php echo site_url();?>"><?php html_img('logo1.jpg','height="130"');?></a>
    </div>

	<form id="frm-login" action="<?php echo site_url('c=member&m=login_do');?>"
		submitbefor="frm_login_befor"
	>
	<table class="tbl-frm-1">
		<tr>
			<td width="220">
				<input class="inp" type="text" name="email"/>
			</td>
			<td>
				<input class="inp" type="password" name="upass"/>
			</td>
			<th>&nbsp;</th>
			<td class="p1"><input id="btn-login_do" class="btn btn-ajax-submit" frmid="frm-login" type="button"/></td>
		</tr>
	</table>
	</form>
</div>

<div style="text-align: center;padding: 20px 0px;">
	<?php if(!$is_login):?>
	<a class="fs2" href="<?php echo site_url('c=member&m=regist');?>">注册</a>
	&nbsp;
	<?php endif;?>
	<a class="fs2" href="<?php echo site_url('c=page&m=about_us');?>">关于我们</a>
	&nbsp;
	<a class="fs2" href="<?php echo site_url('c=page&m=contact_us');?>">联系我们</a>
	&nbsp;
	<a class="fs2" href="<?php echo site_url('c=page&m=help_center');?>">帮助中心</a>
	&nbsp;
	<a class="fs2" href="<?php echo site_url('c=page&m=board');?>">留言板</a>
	&nbsp;&nbsp;&nbsp;&nbsp;
	<span class="c3 fs2">听你 ©2012　tingni.net</span>　	
</div>

<div id="content" style="margin: 10px 20px;margin-top: 30px;background: #fff;position: relative;">
</div>
<input id="page" type="hidden" value="1"/>

<script>

function frm_login_befor($frm){
	$frm.find('.c1').removeClass('c1');
	
	var email = $frm.find('input[name=email]').val().trim();
	if(email.length == 0){
		$('#tip-email').addClass('c1').html('').html('邮箱不能为空！');
	}else if(email.length != 0 && !isEmail(email)){
		$('#tip-email').addClass('c1').html('').html('邮箱格式不正确！');	
	}else{
		$('#tip-email').html('');	
	} 

	var password = $frm.find('input[name=upass]').val().trim();
	if(password.length == 0){
		$('#tip-upass').addClass('c1').html('').html('密码不能为空^^！');
	}else if(password.length != 0 && !isUpass(password)){
		$('#tip-upass').addClass('c1').html('').html('错误的格式！');	
	}else{
		$('#tip-upass').html('');	
	} 

	if($frm.find('.c1').size()>0) return false;
	
	return true;	
	
}


$(function(){
	
	$('#frm-login').keyup(function(e){
		if(e.which == 13){
			$('#btn-login_do').click();
		}
	});

	$('#content').scrollPagination({
		'contentPage': '<?php echo site_url('c=topic&m=get_latest');?>',
		'contentData': {}, // you can pass the children().size() to know where is the pagination
		'scrollTarget': $(window), // who gonna scroll? in this example, the full window
		'heightOffset': 10, // how many pixels before reaching end of the page would loading start? positives numbers only please
		'beforeLoad': function(){ // before load, some function, maybe display a preloader div
		},

		'afterLoad': function(elementsLoaded){ // after loading, some function to animate results and hide a preloader div
			if(elementsLoaded.length <=0 ) asyncbox.tips('没有更多数据!','success');
		}
	});
	
});

</script>
<?php $this->load->view('inc/footer2');?>